<template>
  <div class="my-works">
    <div class="title">
      <div></div>
      <h2>我的作品</h2>
      <p>
        <el-icon>
          <View />
        </el-icon>查看个人页
      </p>
    </div>
    <div class="content">
      <div class="top">
        <div class="inner">
          <el-button
            @click="addArticle"
            round
            plain
            size="large"
            color="#fa715d"
            :icon="Search"
          >新增作品</el-button>
          <el-dropdown trigger="click">
            <span class="el-dropdown-link">
              全部作品
              <el-icon class="el-icon--right" :size="16">
                <ArrowDown />
              </el-icon>
            </span>
            <template #dropdown>
              <el-dropdown-menu>
                <el-dropdown-item :icon="Plus">全部作品</el-dropdown-item>
                <el-dropdown-item :icon="CirclePlusFilled">连载中</el-dropdown-item>
                <el-dropdown-item :icon="CirclePlus">已完结</el-dropdown-item>
                <el-dropdown-item :icon="Check">未发布</el-dropdown-item>
              </el-dropdown-menu>
            </template>
          </el-dropdown>
        </div>
      </div>
      <div class="bottom">
        <div class="list">
          <div class="item" v-for="(item, index) in 2" :key="index">
            <div class="image" @click="weifabuBook">
              <img src="../assets/images/mywork.webp" alt />
            </div>
            <div class="text" @click="weifabuBook">
              <h3>发现</h3>
              <h4>未发布</h4>
              <div class="icon-list">
                <div>
                  <!-- <el-icon :size="16" color="#4a5568">
                    <Bell />
                  </el-icon>-->
                  字
                  <span>17</span>
                </div>
                <div>
                  <!-- <el-icon :size="16" color="#4a5568">
                    <Bell />
                  </el-icon>-->
                  <img class="count-img" src="@/assets/images/wujue.png" alt />
                  <span>17</span>
                </div>
                <div>
                  <!-- <el-icon :size="16" color="#4a5568">
                    <Bell />
                  </el-icon>-->
                  <img class="count-img" src="@/assets/images/details.png" alt />
                  <span>17</span>
                </div>
              </div>
            </div>
            <div class="icon">
              <!-- <img src="@/assets/images/share-1.png" class="share-box" alt srcset /> -->
              <el-dropdown trigger="click">
                <img src="@/assets/images/more-shu.png" class="share-box" alt srcset />
                <template #dropdown>
                  <el-dropdown-menu>
                    <el-dropdown-item :icon="Plus">作品设定</el-dropdown-item>
                    <el-dropdown-item :icon="CirclePlusFilled">
                      <div @click="deleteFabu">取消发布</div>
                    </el-dropdown-item>
                  </el-dropdown-menu>
                </template>
              </el-dropdown>
            </div>
          </div>
        </div>
      </div>

      <!-- <el-dialog :show-close="false" title="新增作1品" v-model="dialogTableVisible" width="40%"> -->
      <van-popup
        v-model:show="dialogTableVisible"
        class="custom-popup"
        round
        position="center"
        :style="{ minHeight: '40%'}"
      >
        <div class="fei-img-box">
          <div class="top-popule-div">作品名称</div>
          <div class="top-input">
            <el-input placeholder="请输入作品名称"></el-input>
          </div>
          <div class="top-popule-div">0 / 65</div>

          <div class="top-popule-div">
            作品类型
            <span class="zhishoa-box">（至少勾选一个类型）</span>
          </div>
          <div class="xioshuo-box-boss">
            <div class="xiaoshuo-title xiaoshuo-title-1">小说</div>
            <div class="xiaoshuo-title">漫画</div>
            <div class="xiaoshuo-title">插画</div>
          </div>

          <div class="top-popule-div">
            作品类别
            <span class="zhishoa-box">（至少勾选一个类型）</span>
          </div>

          <div class="top-popule-div">
            <el-checkbox-group v-model="checkbox">
              <el-checkbox color="red" label="1" v-for="(item, index) in typeBosList" :key="index">
                {{ item.text
                }}
              </el-checkbox>
            </el-checkbox-group>
          </div>
          <div>
            <el-button class="queding-btn" type="primary">确定</el-button>
          </div>
        </div>
      </van-popup>
      <!-- </el-dialog> -->

      <el-dialog :show-close="false" title="取消作品" v-model="deleteShow" width="40%">
        <div class="fei-img-box">
          <div class="top-popule-div">您确定删除作品?删除作品将不可恢復。</div>
          <div>
            <el-button class="queding-btn" type="primary">确定</el-button>
          </div>
        </div>
      </el-dialog>
    </div>
  </div>
</template>

<script setup>
import { ref } from "vue";
import { useRouter } from "vue-router";
import {
  ArrowLeftBold,
  Setting,
  EditPen,
  ArrowDown,
  Sort,
  MoreFilled,
  View,
  Tickets
} from "@element-plus/icons-vue";
const router = useRouter();
const dialogTableVisible = ref(false);
const zuopingType = ref([
  {
    title: "全部"
  },
  {
    title: "恋爱言情"
  },
  {
    title: "恋爱言情"
  },
  {
    title: "恋爱言情"
  },
  {
    title: "恋爱言情"
  },
  {
    title: "恋爱言情"
  },
  {
    title: "恋爱言情"
  },
  {
    title: "恋爱言情"
  }
]);
const titlelist = ref(
  {
    title: "小说"
  },
  {
    title: "漫画"
  },
  {
    title: "插画"
  }
);
const addArticle = () => {
  dialogTableVisible.value = true;
};
const xiaoshuoIndex = ref(0);

const xioashuoAction = index => {
  xiaoshuoIndex.value = index;
};

const weifabuBook = () => {
  router.push("/creation_center/editBook");
};
const deleteShow = ref(false);
const deleteFabu = () => {
  deleteShow.value = true;
};

const typeBosList = ref([
  {
    text: "日常温馨",
    src: "",
    href: "/search"
  },
  {
    text: "西幻",
    src: "",
    href: "/search"
  },
  {
    text: "奇幻",
    src: "",
    href: "/search"
  },
  {
    text: "未来科幻",
    src: "",
    href: "/search"
  },
  {
    text: "重生穿越",
    src: "",
    href: "/search"
  },
  {
    text: "玄幻仙侠武侠",
    src: "",
    href: "/search"
  },
  {
    text: "犯罪悬疑推理",
    src: "",
    href: "/search"
  },
  {
    text: "恐怖惊悚灵异",
    src: "",
    href: "/search"
  },
  {
    text: "青春校园",
    src: "",
    href: "/search"
  },
  {
    text: "现代社会",
    src: "",
    href: "/search"
  },
  {
    text: "古代历史",
    src: "",
    href: "/search"
  },
  {
    text: "近代民国",
    src: "",
    href: "/search"
  },
  {
    text: "其他架空世界观",
    src: "",
    href: "/search"
  }
]);
</script>

<style lang="scss" scoped>
::v-deep .el-checkbox__input.is-checked .el-checkbox__inner {
  background-color: #fa715d;
  /* 选中时的背景色 */
  border-color: #fa715d;
  /* 选中时的边框色 */
}

::v-deep .el-checkbox__input.is-checked + .el-checkbox__label {
  color: #fa715d;
  /* 选中时的文字颜色 */
}

.queding-btn {
  border: none;
  border-radius: 30px;
  padding: 1.5rem 0;
  margin-top: 3rem;
}

.top-input {
  margin-top: 1rem;
}

.top-popule-div {
  margin-top: 2rem;
  margin-bottom: 2rem;
}

.my-works {
  .title {
    display: flex;
    flex: 0 0 auto;
    -webkit-box-align: center;
    align-items: center;
    -webkit-box-pack: justify;
    justify-content: space-between;
    padding-left: 1rem;
    padding-right: 1rem;
    gap: 0.5rem;
    height: 4rem;
    position: relative;
    background-color: #ffffff;

    div {
      width: 3rem;
      height: 100%;
      flex: 0 0 auto;
    }

    h2 {
      font-size: 1.25rem;
      font-weight: 400;
      line-height: 1.5;
      letter-spacing: 0.05em;
      color: #1a202c;
      position: absolute;
      left: 50%;
      transform: translateX(-50%);
    }

    p {
      font-size: 0.875rem;
      font-weight: 500;
      line-height: 1.5;
      letter-spacing: 0.05em;
      color: #1a202c;
      display: flex;
      align-items: center;
      gap: 0.5rem;
      cursor: pointer;
    }
  }

  :deep(.el-button) {
    display: flex;
    font-size: 0.875rem;
    font-weight: 500;
    letter-spacing: 0.05em;
    color: white;
    background-color: #fa715d;
    gap: 0.5rem;
    width: 100%;
    max-width: 16rem;
    margin: 0 auto;
  }

  :deep(.el-dropdown) {
    padding-left: 1rem;
    padding-right: 1rem;
    display: flex;
    height: 4rem;
    -webkit-box-pack: justify;
    justify-content: space-between;
    -webkit-box-align: center;
    align-items: center;
  }

  .content {
    .top {
      background: #ffffff;

      .inner {
        max-width: 61.5rem;
        margin: 0px auto;
        width: 100%;
      }
    }

    .bottom {
      margin: 0px auto;
      width: 100%;
      max-width: 61.5rem;

      .list {
        padding: 1rem;
        display: flex;
        flex: 1 1 auto;
        // gap: 1rem;
        flex-direction: column;

        .item {
          display: flex;
          background: #edf2f7;
          border-radius: 0.25rem;
          align-items: center;
          height: 8rem;
          margin-bottom: 1rem;

          .image {
            height: 8rem;
            flex: 0 0 auto;
            position: relative;
            aspect-ratio: 7 / 10;
            width: 5rem;
            clip-path: inset(0px round 0.25rem 0px 0px 0.25rem);

            img {
              display: block;
              width: 100%;
              height: 8rem;
            }
          }

          .text {
            display: flex;
            flex-direction: column;
            gap: 0.5rem;
            padding: 1rem 0rem 1rem 1rem;
            flex: 1 1 0px;

            h3 {
              font-size: 0.875rem;
              font-weight: 500;
              line-height: 1.5;
              letter-spacing: 0.05em;
              color: #1a202c;
              text-overflow: ellipsis;
              overflow: hidden;
              white-space: nowrap;
            }

            h4 {
              font-size: 0.75rem;
              font-weight: 400;
              line-height: 1.625;
              letter-spacing: 0.05em;
              color: #718096;
            }

            .icon-list {
              display: flex;
              -webkit-box-align: center;
              align-items: center;
              gap: 0.5rem;
              flex-wrap: wrap;
              font-size: 0.75rem;
              div {
                display: flex;
                align-items: center;
                gap: 0.5rem;

                span {
                  font-weight: 300;
                  line-height: 1.625;
                  letter-spacing: 0.05em;
                  color: #4a5568;
                  text-overflow: ellipsis;
                  overflow: hidden;
                  white-space: nowrap;
                }
              }
            }
          }

          .icon {
            padding: 0.25rem;
            border: none;
            border-radius: 4px;
            display: flex;
            justify-content: center;
            align-items: center;
            width: 3rem;
            height: 3rem;
          }
        }
      }
    }
  }
}

.share-box {
  width: 15px;
}

.fengmian-box,
.fengmian-boss {
  min-width: 127px;
  min-height: 182px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
}

.xioshuo-box-boss {
  width: 100%;
}

.xiaoshuo-title {
  border-radius: 1rem;
  width: 30%;
  border: 1px #e5e5e5 solid;
  display: inline-flex;
  margin-left: 2%;
  align-items: center;
  justify-content: center;
  padding: 0.4rem 0;
}

.xiaoshuo-title:nth-of-type(1) {
  margin-left: 0;
}

.xiaoshuo-title-1 {
  border: 1px #fa715d solid;
  color: #fa715d;
}

.zhishoa-box {
  font-size: 0.8rem;
  color: #fa715d;
}
.custom-popup {
  padding: 0 16px 16px 16px; /* 设置内边距 */
}
</style>